package com.xmg.design23.d7_compose;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: mazhongqing
 * @Date: 2021/3/24 16:27
 */
public class Manager extends Component{
    private List<Component> components = new ArrayList<>();

    public Manager(String position,String job){
        super(position,job);
    }

    public void addComponent(Component component){
        components.add(component);
    }

    public void removeComponent(Component component){
        components.remove(component);
    }

    @Override
    void check() {
        work();
        for(Component component:components){
            component.check();
        }
    }
}
